-- 
_co_1 = coroutine.create(
  function(i)
    print(i);
  end
)

coroutine.resume(_co_1, 1)  -- 1
print(coroutine.status(_co_1))  -- dead

print("----- -----")

_co_2 = coroutine.wrap(
  function(i)
    print(i);
  end
)

_co_2(2)

print("----- -----")

_co_3 = coroutine.create(
  function()
    for _i = 1, 10 do
      print(_i)
      if _i == 2 then
        print("+++++ +++++")
        print(coroutine.status(_co_3))  -- running
        print(coroutine.running())  -- thread:
        print("+++++ +++++")
      elseif 3 == _i then
        print("+++++ +++++")
        print(coroutine.status(_co_3))  -- running
        print(coroutine.running())  -- thread:
        print("+++++ +++++")
      end
      coroutine.yield()
    end
  end
)

coroutine.resume(_co_3)  -- 1
coroutine.resume(_co_3)  -- 2
coroutine.resume(_co_3)  -- 3

print(coroutine.status(_co_3))  -- suspended
print(coroutine.running())

print("----- -----")

coroutine.resume(_co_3)  -- 4
print(coroutine.status(_co_3))  -- suspended
